package com.itheima.test4;

public class Test {
    public static void main(String[] args) {
        Animal a = new Cat();
        show(a);

        a = new Dog();
        show(a);

    }

    public  static void show(Animal a){
        a.eat();

        if(a instanceof Cat){
            Cat c = (Cat) a;
            c.play();
        }else if(a instanceof Dog){
            Dog d = (Dog) a;
            d.lookHome();
        }
    }
}
